#pragma once


#include "CPrintBase.h"
class CPrintRegion;
class CPage;
class CDialogPrinterOptions;


class CPrintSkillung : public CPrintBase
{
    private:

        struct struct_page_contents
        {
            bool b_title;
            bool b_base_stats; // base, stats, ML
            double n_base_end;
            bool b_skills;
            double n_skills_end;

            int  idx_style_start;
            int  idx_style_end;
            int  n_style_nof_heads;
            bool b_styles_print_head;
            double n_styles_end;

            int  idx_spell_start;
            int  idx_spell_end;
            double n_spell_end;
            int  n_spell_nof_heads;
            bool b_spells_print_description;

            int  n_ra_nof_heads;
            int  idx_ra_start;
            int  idx_ra_end;
            double n_ra_end;

            struct_page_contents();
        };


    public:
        CPrintSkillung(void);
        CPrintSkillung(CCharplanDoc* doc);
        ~CPrintSkillung(void);

        BOOL OnPreparePrinting(CPrintInfo* pInfo);
        void OnPrint(CDC* pDC, CPrintInfo* pInfo);
        void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
        void OnEndPrintPreview(CDC* pDC, CPrintInfo* pInfo, POINT point, CPreviewView* pView);
        void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);

    private:

        void PrintInfo(CPage*, CPrintRegion*);
        void PrintStats(CPage*, CPrintRegion*);
        void PrintML(CPage*, CPrintRegion*);

        double PrintTab(CPage* pPage, CPrintRegion*, double row, double col1, double col2, LPCTSTR t1, LPCTSTR t2);
        double PrintTab(CPage* pPage, CPrintRegion*reg, double row, double col1, double col2, int ptsize, LPCTSTR t1, LPCTSTR t2);

        void GetAllSkillNames(CStringArray&);
        int  GetSkillLevel(CString name, float level); // level only used in carrer mode

        void GetListOfStyles(CStringArray& spec,    IntArray& specline, IntArray& indent, CStringArray& name, IntArray& level, int& nof_specs);

        void GetListOfSpells(
            CStringArray& base,  ///< names of the base (1-3)
            CStringArray& spec,  ///< names of the spec (1-3) (can be empty for spec only)

            IntArray& cat_spec,  ///< number of base/spec which following category belongs to +1 (- for spec)
            CStringArray& cat,  ///< category

            IntArray& spell_cat, ///< number of category which following spell belongs to
            CStringArray& name,  ///< names of all spells
            IntArray& level   ///< level of these spells
        );

        void GetListOfRAs(CStringArray& names, CStringArray& shnames, CStringArray& reuse, CStringArray& ratypes, CStringArray& types, CStringArray lvl[5]);

        void NewPage();

        // ------------------- DATA ----------------------
        CDialogPrinterOptions*   mpc_options;
        CArray <struct_page_contents> m_as_pages;
};
